const { defineConfig } = require('@vue/cli-service');
const path = require('path');
const isProduction = process.env.NODE_ENV === 'production';

module.exports = defineConfig({
    transpileDependencies: true,
    css: {
        sourceMap: !isProduction,
        loaderOptions: {
            sass: {
                additionalData: `@import "~public/styles/1px.scss";`,
            },
        },
    },
    configureWebpack: {
        resolve: {
            alias: {
                '@': path.resolve(__dirname, './src'),
                components: path.resolve(__dirname, './src/views/components'),
                api: path.resolve(__dirname, './src/api'),
                public: path.resolve(__dirname, './src/public'),
                resources: path.resolve(__dirname, './src/assets'),
            },
        },
    },
    devServer: {
        proxy: {
            '/api': {
                target: 'http://localhost:3000',
                ws: false,
                changeOrigin: true,
            },
        },
    },
});
